package com.example.li.day8_15;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.example.li.day8_15.utils.HttpUtils;

import java.util.HashMap;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {

    private final static String TAG="RegisterActivity";
    private EditText userName;
    private EditText psw;
    private TextView tv_commit;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register1);
        intiView();
    }

    private void intiView() {
        userName = findViewById(R.id.et_phone);
        psw = findViewById(R.id.et_psw);
        tv_commit = findViewById(R.id.tv_commit);
        tv_commit.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        String userName = this.userName.getText().toString();
        String psw = this.psw.getText().toString();
        String address="http://192.168.3.159:8080/home/getWeChats.do?pageNum=1&pageCount=10";
        HashMap<String, String> map = new HashMap<>();
        map.put("pageNum",userName);
        map.put("pageCount",psw);
        HttpUtils.get(address, map, new HttpUtils.OnHttpCallback() {
            @Override
            public void onSuccess(String response) {
                Log.d(TAG, "onSuccess: "+response);

            }

            @Override
            public void onFailure(String error) {

            }
        });
    }
}
